# div对话框的处理
from selenium import webdriver
import time
import os
driver = webdriver.Chrome()
url = "file:///" + os.path.abspath("div_alert.html")
driver.get(url)
driver.maximize_window()
time.sleep(3)
# 点击click 出现弹框
driver.find_element_by_link_text("Click").click()
time.sleep(3)
# 点击div框里面的clicK me 让弹出框大发生变化
div1 = driver.find_element_by_class_name("modal-body")
div1.find_element_by_link_text("click me").click()
time.sleep(3)

# 弹出了另一个框，然后需要点击close关闭他
# 先获取按钮的div框
div2 = driver.find_element_by_class_name("modal-footer")
buttons = div2.find_element_by_tag_name("button")
# 按钮有两个，点击第一个即可，使用数组执行
buttons[0].click()
time.sleep(3)
driver.quit()
